* Time dependent censoring.sps.
* Written by PSKL on 19/09/02.

Get file='D:\Longitudinal Data\Claims Master 1991 to 2001.sav'.


* Create year/month variable and schednum to number of months.
* Then calculate observation interval in months to next schednum if revisit or 10203 if not.

Compute lstmsn=(lastyear-1900)*100 + lastmont.
Compute schedym=trunc(schednum/100)*12 + schednum - 100*trunc(schednum/100).
Compute lastym = (lastyear-1900)*12 + lastmont.


sort cases by patidn (a) schednum lastym (d).

compute revisit = 0.
if (patidn=lag(patidn)) revisit = 1.

compute  interval = 12*102+3 - lastym.
if (patidn=lag(patidn))interval = lag(schedym) - lastym.

formats patidn claimidn (F10) lstmsn interval (F6) revisit (F1).

save outfile='d:\temp1.sav'
/keep patidn claimidn lstmsn schednum interval revisit fpcnum exempbox.

get file='d:\temp1.sav'.

CROSSTABS
  /TABLES=interval  BY revisit
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 19-NOV-2002 11:01:00
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 732386
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 2
Cells Available 116508
Elapsed Time 0:00:06.21

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT 732386 100.0% 0 .0% 732386 100.0%


INTERVAL * REVISIT Crosstabulation
Count

REVISIT Total
0 1
INTERVAL 0 1009 1117 2126
1 4005 16450 20455
2 5039 34894 39933
3 3669 38998 42667
4 4845 42783 47628
5 4407 37886 42293
6 3540 49524 53064
7 2602 108691 111293
8 2256 82270 84526
9 1890 48283 50173
10 1597 31891 33488
11 1357 22341 23698
12 1291 17499 18790
13 1058 15268 16326
14 993 12380 13373
15 722 10316 11038
16 946 8327 9273
17 805 6807 7612
18 683 5823 6506
19 693 4973 5666
20 661 4308 4969
21 676 3817 4493
22 634 3391 4025
23 544 3156 3700
24 632 2971 3603
25 588 2620 3208
26 533 2313 2846
27 473 2051 2524
28 540 1839 2379
29 514 1621 2135
30 551 1506 2057
31 430 1370 1800
32 509 1257 1766
33 486 1162 1648
34 424 1032 1456
35 452 964 1416
36 517 972 1489
37 423 829 1252
38 391 821 1212
39 361 814 1175
40 415 679 1094
41 419 681 1100
42 446 620 1066
43 414 635 1049
44 428 573 1001
45 423 554 977
46 365 464 829
47 406 494 900
48 454 464 918
49 372 414 786
50 397 434 831
51 355 411 766
52 360 390 750
53 366 380 746
54 349 368 717
55 298 294 592
56 392 278 670
57 358 274 632
58 317 248 565
59 328 264 592
60 359 251 610
61 340 235 575
62 346 263 609
63 273 214 487
64 337 228 565
65 366 210 576
66 306 190 496
67 317 205 522
68 362 177 539
69 337 175 512
70 333 176 509
71 349 157 506
72 341 148 489
73 318 142 460
74 337 130 467
75 258 127 385
76 344 130 474
77 352 141 493
78 300 138 438
79 312 119 431
80 331 111 442
81 335 106 441
82 323 109 432
83 317 91 408
84 351 83 434
85 305 105 410
86 281 87 368
87 279 84 363
88 300 76 376
89 317 58 375
90 306 63 369
91 276 68 344
92 304 64 368
93 331 62 393
94 262 56 318
95 279 58 337
96 334 50 384
97 288 42 330
98 227 39 266
99 210 48 258
100 323 46 369
101 265 48 313
102 289 36 325
103 281 32 313
104 297 29 326
105 275 30 305
106 271 41 312
107 261 31 292
108 333 17 350
109 312 28 340
110 265 14 279
111 229 28 257
112 297 20 317
113 286 12 298
114 272 20 292
115 251 13 264
116 281 13 294
117 308 9 317
118 216 15 231
119 200 10 210
120 238 26 264
121 231 10 241
122 217 8 225
123 194 3 197
124 233 14 247
125 241 3 244
126 227 4 231
127 190 3 193
128 230 4 234
129 187 2 189
130 196 7 203
131 193 2 195
132 172
172
133 156 1 157
134 169
169
Total 82537 649849 732386

* Create look-up file of probability of reattendance.

Aggregate outfile=*
 /break interval revisit
 /n=n.

sort cases by interval revisit (d).
compute cases=n.
if (revisit=0 and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by interval.

save outfile='D:\Longitudinal Data\reattendance probability.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.

*****************************************************************************************.

* Repeat analysis contrasting between London and elsewhere.

get file='d:\temp1.sav'.
sort cases by FPCNUM.
Match files file=*
 /table='d:\longitudinal data\London FPCNUMS.sav'
 /by FPCNUM.
Compute London=0.
If (n>0) London=1.

save outfile='d:\temp2.sav'.

CROSSTABS
  /TABLES=interval  BY revisit By LONDON
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 19-NOV-2002 11:02:15
Comments
Input Data d:\temp2.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 732386
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit By LONDON
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 3
Cells Available 95325
Elapsed Time 0:00:07.02

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT * LONDON 732386 100.0% 0 .0% 732386 100.0%


INTERVAL * REVISIT * LONDON Crosstabulation
Count

REVISIT Total
LONDON 0 1
.00 INTERVAL 0 960 1092 2052
1 3575 14840 18415
2 4499 30503 35002
3 3241 34161 37402
4 4217 37720 41937
5 3869 32949 36818
6 3086 44417 47503
7 2232 97457 99689
8 1917 72334 74251
9 1571 41899 43470
10 1315 27297 28612
11 1104 18962 20066
12 1043 14737 15780
13 851 12799 13650
14 790 10302 11092
15 576 8557 9133
16 731 6868 7599
17 618 5580 6198
18 538 4751 5289
19 528 3973 4501
20 514 3481 3995
21 518 3092 3610
22 493 2735 3228
23 436 2527 2963
24 499 2408 2907
25 459 2103 2562
26 423 1863 2286
27 368 1643 2011
28 420 1463 1883
29 420 1264 1684
30 444 1168 1612
31 339 1082 1421
32 397 988 1385
33 374 937 1311
34 323 827 1150
35 363 754 1117
36 400 771 1171
37 339 653 992
38 314 616 930
39 285 640 925
40 340 522 862
41 323 535 858
42 352 482 834
43 337 484 821
44 327 439 766
45 328 433 761
46 279 376 655
47 324 397 721
48 359 360 719
49 279 325 604
50 304 347 651
51 285 325 610
52 279 322 601
53 280 305 585
54 272 289 561
55 241 245 486
56 303 217 520
57 262 216 478
58 246 198 444
59 250 204 454
60 283 209 492
61 264 184 448
62 267 209 476
63 219 172 391
64 268 178 446
65 280 160 440
66 238 150 388
67 231 164 395
68 277 150 427
69 249 134 383
70 251 142 393
71 259 119 378
72 271 119 390
73 239 111 350
74 274 110 384
75 210 101 311
76 263 109 372
77 271 114 385
78 236 110 346
79 253 99 352
80 273 93 366
81 257 87 344
82 261 91 352
83 246 70 316
84 289 64 353
85 243 83 326
86 212 74 286
87 220 68 288
88 233 59 292
89 260 44 304
90 248 49 297
91 214 53 267
92 235 51 286
93 253 43 296
94 192 49 241
95 213 48 261
96 260 44 304
97 229 38 267
98 175 29 204
99 177 40 217
100 250 32 282
101 217 39 256
102 232 29 261
103 224 30 254
104 235 25 260
105 197 23 220
106 195 36 231
107 209 27 236
108 276 14 290
109 243 22 265
110 219 13 232
111 187 22 209
112 233 17 250
113 218 7 225
114 222 16 238
115 193 11 204
116 205 12 217
117 236 7 243
118 170 13 183
119 149 8 157
120 187 15 202
121 164 9 173
122 164 5 169
123 143 2 145
124 189 11 200
125 170 2 172
126 174 2 176
127 150 3 153
128 163 2 165
129 129 2 131
130 156 7 163
131 145 2 147
132 129
129
133 118 1 119
134 124
124
Total 67767 563721 631488
1.00 INTERVAL 0 49 25 74
1 430 1610 2040
2 540 4391 4931
3 428 4837 5265
4 628 5063 5691
5 538 4937 5475
6 454 5107 5561
7 370 11234 11604
8 339 9936 10275
9 319 6384 6703
10 282 4594 4876
11 253 3379 3632
12 248 2762 3010
13 207 2469 2676
14 203 2078 2281
15 146 1759 1905
16 215 1459 1674
17 187 1227 1414
18 145 1072 1217
19 165 1000 1165
20 147 827 974
21 158 725 883
22 141 656 797
23 108 629 737
24 133 563 696
25 129 517 646
26 110 450 560
27 105 408 513
28 120 376 496
29 94 357 451
30 107 338 445
31 91 288 379
32 112 269 381
33 112 225 337
34 101 205 306
35 89 210 299
36 117 201 318
37 84 176 260
38 77 205 282
39 76 174 250
40 75 157 232
41 96 146 242
42 94 138 232
43 77 151 228
44 101 134 235
45 95 121 216
46 86 88 174
47 82 97 179
48 95 104 199
49 93 89 182
50 93 87 180
51 70 86 156
52 81 68 149
53 86 75 161
54 77 79 156
55 57 49 106
56 89 61 150
57 96 58 154
58 71 50 121
59 78 60 138
60 76 42 118
61 76 51 127
62 79 54 133
63 54 42 96
64 69 50 119
65 86 50 136
66 68 40 108
67 86 41 127
68 85 27 112
69 88 41 129
70 82 34 116
71 90 38 128
72 70 29 99
73 79 31 110
74 63 20 83
75 48 26 74
76 81 21 102
77 81 27 108
78 64 28 92
79 59 20 79
80 58 18 76
81 78 19 97
82 62 18 80
83 71 21 92
84 62 19 81
85 62 22 84
86 69 13 82
87 59 16 75
88 67 17 84
89 57 14 71
90 58 14 72
91 62 15 77
92 69 13 82
93 78 19 97
94 70 7 77
95 66 10 76
96 74 6 80
97 59 4 63
98 52 10 62
99 33 8 41
100 73 14 87
101 48 9 57
102 57 7 64
103 57 2 59
104 62 4 66
105 78 7 85
106 76 5 81
107 52 4 56
108 57 3 60
109 69 6 75
110 46 1 47
111 42 6 48
112 64 3 67
113 68 5 73
114 50 4 54
115 58 2 60
116 76 1 77
117 72 2 74
118 46 2 48
119 51 2 53
120 51 11 62
121 67 1 68
122 53 3 56
123 51 1 52
124 44 3 47
125 71 1 72
126 53 2 55
127 40
40
128 67 2 69
129 58
58
130 40
40
131 48
48
132 43
43
133 38
38
134 45
45
Total 14770 86128 100898

get file='d:\temp2.sav'.

Aggregate outfile=*
 /break interval revisit London
 /n=n.

sort cases by London (a) interval revisit (d).
compute cases=n.
if (revisit=0 and lag(London)=London and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1 and Lag (London) = London).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by London interval.

save outfile='D:\Longitudinal Data\reattendance probability London.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.

*******************************************************************************************.

* Repeat the exercise for paying vs exempt.

get file='d:\temp1.sav'.

Compute Fullpay=1.
If (exempbox ne ' ') Fullpay=0.

CROSSTABS
  /TABLES=interval  BY revisit By Fullpay
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 19-NOV-2002 11:02:27
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 732386
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit By Fullpay
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 3
Cells Available 95325
Elapsed Time 0:00:22.24

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT * FULLPAY 732386 100.0% 0 .0% 732386 100.0%


INTERVAL * REVISIT * FULLPAY Crosstabulation
Count

REVISIT Total
FULLPAY 0 1
.00 INTERVAL 0 213 393 606
1 879 5168 6047
2 1111 9948 11059
3 762 10884 11646
4 1026 11859 12885
5 976 10320 11296
6 806 11862 12668
7 607 20045 20652
8 556 15861 16417
9 469 10121 10590
10 446 7063 7509
11 382 5186 5568
12 371 4335 4706
13 303 3698 4001
14 301 3153 3454
15 217 2645 2862
16 283 2168 2451
17 274 1879 2153
18 218 1617 1835
19 232 1456 1688
20 212 1233 1445
21 223 1141 1364
22 209 1040 1249
23 174 925 1099
24 189 883 1072
25 212 815 1027
26 198 727 925
27 153 622 775
28 171 611 782
29 159 543 702
30 201 510 711
31 162 457 619
32 156 411 567
33 184 411 595
34 145 332 477
35 150 302 452
36 190 321 511
37 161 295 456
38 137 287 424
39 112 294 406
40 154 234 388
41 142 228 370
42 156 212 368
43 126 231 357
44 137 197 334
45 155 191 346
46 121 177 298
47 152 165 317
48 167 166 333
49 114 139 253
50 135 145 280
51 96 141 237
52 122 141 263
53 131 124 255
54 119 121 240
55 101 99 200
56 138 106 244
57 132 83 215
58 116 87 203
59 117 83 200
60 122 83 205
61 115 74 189
62 113 94 207
63 102 66 168
64 118 81 199
65 128 79 207
66 100 53 153
67 104 62 166
68 114 59 173
69 127 60 187
70 116 61 177
71 106 62 168
72 117 57 174
73 112 48 160
74 99 44 143
75 63 53 116
76 108 36 144
77 103 48 151
78 81 44 125
79 85 35 120
80 99 33 132
81 97 36 133
82 112 32 144
83 84 27 111
84 102 29 131
85 72 44 116
86 73 24 97
87 82 31 113
88 91 23 114
89 95 16 111
90 85 21 106
91 96 26 122
92 98 19 117
93 90 24 114
94 70 18 88
95 80 19 99
96 108 12 120
97 88 6 94
98 66 13 79
99 80 13 93
100 86 15 101
101 84 16 100
102 95 8 103
103 73 5 78
104 82 8 90
105 91 6 97
106 93 14 107
107 75 10 85
108 92 7 99
109 84 8 92
110 63 2 65
111 55 8 63
112 59 5 64
113 78 2 80
114 80 6 86
115 74 5 79
116 73 3 76
117 102 1 103
118 58 9 67
119 65 4 69
120 73 4 77
121 69 3 72
122 50 3 53
123 52
52
124 60 3 63
125 78
78
126 64 1 65
127 57
57
128 70
70
129 65
65
130 51 3 54
131 58
58
132 50
50
133 32
32
134 38
38
Total 22891 156715 179606
1.00 INTERVAL 0 796 724 1520
1 3126 11282 14408
2 3928 24946 28874
3 2907 28114 31021
4 3819 30924 34743
5 3431 27566 30997
6 2734 37662 40396
7 1995 88646 90641
8 1700 66409 68109
9 1421 38162 39583
10 1151 24828 25979
11 975 17155 18130
12 920 13164 14084
13 755 11570 12325
14 692 9227 9919
15 505 7671 8176
16 663 6159 6822
17 531 4928 5459
18 465 4206 4671
19 461 3517 3978
20 449 3075 3524
21 453 2676 3129
22 425 2351 2776
23 370 2231 2601
24 443 2088 2531
25 376 1805 2181
26 335 1586 1921
27 320 1429 1749
28 369 1228 1597
29 355 1078 1433
30 350 996 1346
31 268 913 1181
32 353 846 1199
33 302 751 1053
34 279 700 979
35 302 662 964
36 327 651 978
37 262 534 796
38 254 534 788
39 249 520 769
40 261 445 706
41 277 453 730
42 290 408 698
43 288 404 692
44 291 376 667
45 268 363 631
46 244 287 531
47 254 329 583
48 287 298 585
49 258 275 533
50 262 289 551
51 259 270 529
52 238 249 487
53 235 256 491
54 230 247 477
55 197 195 392
56 254 172 426
57 226 191 417
58 201 161 362
59 211 181 392
60 237 168 405
61 225 161 386
62 233 169 402
63 171 148 319
64 219 147 366
65 238 131 369
66 206 137 343
67 213 143 356
68 248 118 366
69 210 115 325
70 217 115 332
71 243 95 338
72 224 91 315
73 206 94 300
74 238 86 324
75 195 74 269
76 236 94 330
77 249 93 342
78 219 94 313
79 227 84 311
80 232 78 310
81 238 70 308
82 211 77 288
83 233 64 297
84 249 54 303
85 233 61 294
86 208 63 271
87 197 53 250
88 209 53 262
89 222 42 264
90 221 42 263
91 180 42 222
92 206 45 251
93 241 38 279
94 192 38 230
95 199 39 238
96 226 38 264
97 200 36 236
98 161 26 187
99 130 35 165
100 237 31 268
101 181 32 213
102 194 28 222
103 208 27 235
104 215 21 236
105 184 24 208
106 178 27 205
107 186 21 207
108 241 10 251
109 228 20 248
110 202 12 214
111 174 20 194
112 238 15 253
113 208 10 218
114 192 14 206
115 177 8 185
116 208 10 218
117 206 8 214
118 158 6 164
119 135 6 141
120 165 22 187
121 162 7 169
122 167 5 172
123 142 3 145
124 173 11 184
125 163 3 166
126 163 3 166
127 133 3 136
128 160 4 164
129 122 2 124
130 145 4 149
131 135 2 137
132 122
122
133 124 1 125
134 131
131
Total 59646 493134 552780

Aggregate outfile=*
 /break interval revisit Fullpay
 /n=n.

sort cases by Fullpay (a) interval revisit (d).
compute cases=n.
if (revisit=0 and lag(Fullpay)=Fullpay and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1 and Lag (Fullpay) = Fullpay).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by Fullpay interval.

save outfile='D:\Longitudinal Data\reattendance probability Fullpay.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.